import React from 'react';
import { connect } from 'dva';
import { Layout, Menu, Dropdown, Icon, Avatar } from 'antd';
const { Header } = Layout;
const { SubMenu } = Menu;
@connect(({ auth }) => ({
    userInfo: auth.userInfo
}))
class MHearder extends React.PureComponent {
    constructor(props) {
        super(props);
    }

    logOut = () => {
        const { dispatch } = this.props;
        dispatch({
            type: 'auth/loginOut'
        });
    }

    render() {
        const { logOut } = this;
        return (<Header style={{ background: '#fff', padding: 0 }} className="betweenX">
            <div></div>
            <div style={{ paddingRight: "40px" }}>
                <Dropdown overlay={(<Menu>
                    <Menu.Item key="0">个人信息</Menu.Item>
                    <Menu.Item key="1">修改密码</Menu.Item>
                    <Menu.Divider />
                    <Menu.Item key="3" onClick={logOut}>安全退出</Menu.Item>
                </Menu>)}>
                    <a className="ant-dropdown-link" href="#">
                        <Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" /> <Icon type="down" />
                    </a>
                </Dropdown>
            </div>
        </Header>);
    }
}

export default MHearder;